import request from '@/utils/request'

export function list(query) {
  return request({
    url: '/recruit/recruiter/list',
    method: 'get',
    params: query
  })
}

export function getRecruiter(recruitId) {
  return request({
    url: '/recruit/recruiter/' + recruitId,
    method: 'get'
  })
}

export function getRecruiterResult(recruitResultId) {
  return request({
    url: '/recruit/recruiter/result/' + recruitResultId,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/recruit/recruiter',
    method: 'post',
    data: data
  })
}

export function addResult(data) {
  return request({
    url: '/recruit/recruiter/result',
    method: 'post',
    data: data
  })
}

export function update(data) {
  return request({
    url: '/recruit/recruiter',
    method: 'put',
    data: data
  })
}

export function updateResult(data) {
  return request({
    url: '/recruit/recruiter/result',
    method: 'put',
    data: data
  })
}

// 文件列表
export function fileList(recruitId) {
  return request({
    url: '/recruit/recruiter/files/' + recruitId,
    method: 'get'
  })
}

// 预览文件 (获取文件全路径)
export function viewFile(resource) {
  return request({
    url: '/recruit/recruiter/view?resource=' + resource,
    method: 'get'
  })
}

// 删除文件
export function delFile(recruitFileId) {
  return request({
    url: '/recruit/recruiter/' + recruitFileId,
    method: 'delete'
  })
}
